<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title><?php echo $head_title; ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<?php echo $heads; ?>
<?php echo $styles; ?>
<?php echo $scripts; ?>
</head>

<?php
  global $base_theme_info, $language_code, $conf;
  if (!empty($base_theme_info['settings']) && !empty($base_theme_info['settings']['layout_fluid'])) {
    $container = 'container-fluid';
  } else {
    $container = 'container';
  }
  switch ($base_theme_info['settings']['site_menu_brand']) {
    case 'text':
      $brand = '<span class="site_menu_brand_text">' . $site_global->name . '</span>';
    break;
    case 'custom':
      $brand = '<span class="site_menu_brand_text">' . $base_theme_info['settings']['site_menu_brand_text'] . '</span>';
    break;
    default:
      $brand = '<img src="' . $site_global->logo . '" alt="' . $site_global->slogan . '" title="' . $site_global->name . '" />';
  }
?>

<body class="<?php echo $user_login_status;?> <?php echo $args_id;?>">
<header class="navbar fixed-top navbar-expand-lg navbar-dark navbar-light bg-dark">
  <div class="<?php echo $container;?>">
    <a href="<?php echo $base_path?>" title="<?php echo $site_global->name . ($site_global->slogan ? (' - ' . $site_global->slogan) : ''); ?>" class="navbar-brand logo">
      <?php echo $brand;?>
    </a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#site-navbar" aria-controls="site-navbar" aria-expanded="false" aria-label="显示/隐藏导航">
      <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse" id="site-navbar">
      <?php echo $menu; ?>
      <?php if (!empty($lang_links)) : ?>
      <ul id="choose-languages" class="nav navbar-nav pull-right">
        <li class="nav-item dropdown">
        <a data-toggle="dropdown" class="nav-link dropdown-toggle" role="button" href="#" title="<?php echo t('bootheme', '选择语言'); ?>" aria-haspopup="true" aria-expanded="false">
          <?php 
            echo $conf['languages'][$language_code];
          ?>
        </a>
        <?php echo $lang_links;?>
        </li>
      </ul>
      <?php endif ;?>
    </div>
  </div>
</header>

<div id="main" class="<?php echo $container; ?>"> 
  <div class="row">
    <?php if ($left) : ?>
    <div id="sidebar-left" class="sidebar col-lg-3 col-md-5">
      <?php echo $left; ?>
    </div>
    <?php endif; ?>

<?php
if ($left && $right) {
  $content_class = 'col-lg-6 col-md-7';
} else if ($left) {
  $content_class = 'col-lg-9 col-md-7 last';
} else if ($right) {
  $content_class = 'col-lg-9 col-md-7';
} else {
  $content_class = 'col-lg-12 col-md-12';
}
?>

    <div id="content" class="<?php echo $content_class;?>">
      <?php echo $breadcrumb; ?>
      <?php echo $tabs; ?>
      <?php echo $sub_tabs; ?>
      <?php echo $messages; ?>
      <?php echo $help; ?>
      <?php echo is_array($content) && !empty($content['__dida_content_return_html']) ? $content['__dida_content_return_html'] : $content; ?>
    </div>

    <?php if ($right) : ?>
    <div id="sidebar-right" class="sidebar col-lg-3 col-md-5 last">
      <?php echo $right; ?>
    </div>
    <?php endif; ?>
  </div>
  
  <?php echo $debug; ?>
</div>

<div id="footer">
  <div class="<?php echo $container;?>">
    <?php echo $site_global->footer; ?>
    <?php echo $footer; ?>
  </div>
</div>

<?php echo $closure; ?>

</body>
</html>
